let packageName = require('./package.json').name
const CopyWebpackPlugin = require('copy-webpack-plugin')
module.exports = {
    publicPath: '/app-workflow-public',
    devServer: {
        port: 9003,
        headers: {
            'Access-Control-Allow-Origin': '*'
        },
        disableHostCheck: true
    },
    configureWebpack:config => {
        let r = {
            output:{
                library: packageName,
                libraryTarget: 'umd',
                jsonpFunction: `webpackJsonp_${packageName}`,
            },
            plugins: [
                new CopyWebpackPlugin([
                    {
                        from: process.env.VUE_APP_PORTALONEBACKEND == 'true' ? './src/flowable-ext/config/flowable-baseurl-backend-one.js':'./src/flowable-ext/config/flowable-baseurl-backend-mul.js',
                        to: 'flowable-ext/config/flowable-backend-baseurl.js'
                    },
                    {
                        from: process.env.VUE_APP_PORTALONE == 'true' ? './src/flowable-ext/config/flowable-baseurl-frontend-one.js':'./src/flowable-ext/config/flowable-baseurl-frontend-mul.js',
                        to: 'flowable-ext/config/flowable-frontend-baseurl.js'
                    }
                ])
            ]
        }
        return r
    },
    chainWebpack: config => {
        config.devServer.set('inline', false)
        config.devServer.set('hot', false)
    },
    filenameHashing: false
}